<?php

namespace App\Models\V1;


use Illuminate\Database\Eloquent\Factories\HasFactory;


class Vote extends BaseModel
{
    use HasFactory;

    protected $connection;
    protected $table = 'wy_vote';
    protected $fillable=['id','title','content','vote_class_id','preparatory_id','end_time','thumb','voter_turnout','n_vote','a_vote','state'];



    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->connection = config('database.connections.wuye.database');
    }

    /**
     * 状态
     * @param $key
     * @return string
     */
    public function getStateAttribute($key)
    {
        return (string) $key;
    }


    public function VoteClass()
    {
        return $this->hasOne(VoteClass::class, 'id', 'vote_class_id');
    }












}
